﻿@{
    ViewBag.Title = "按钮列表";
    Layout = "~/Views/Shared/_ListLayout.cshtml";
}
@inherits CMSWebViewPage<object>
<div id="toolbar_buttoninfo" class="datagrid-toolbar">
    @CurrentButtonTool.Create()
</div>
<table id="dg_buttoninfo" data-options="url:'/buttoninfo/listjson',border:false,fit:true,fitColumns:true,toolbar:'#toolbar_buttoninfo',singleSelect:true,pagination:true,pageSize:20">
    <thead>
        <tr>
            <th data-options="field:'ck',checkbox:true"></th>
            <th data-options="field:'Id',width:40,align:'center'">Id</th>
            <th data-options="field:'ButtonName',width:80,align:'center'">按钮名称</th>
            <th data-options="field:'IconPreview',width:40,formatter:PreviewIcon,align:'center'">图标预览</th>
            <th data-options="field:'IsWriteControllerName',formatter:BooleanToString,width:40,align:'center'">是否写入控制器</th>
            <th data-options="field:'DefaultActionName',width:80,align:'center'">默认Action名称</th>
            <th data-options="field:'DefaultPosition',formatter:FomentPosition,width:80,align:'center'">默认位置</th>
            <th data-options="field:'DefaultExecution',width:80,align:'center'">默认执行脚本</th>
            <th data-options="field:'SortIndex',width:40,align:'center'">排序号</th>
        </tr>
    </thead>
</table>
@section Bottom{
    <script type="text/javascript">
        var objBizDatagrid = new BizDatagrid('#dg_buttoninfo');
        function Add() {
            objBizDatagrid.add("/buttoninfo/editpage/");
        }
        function Edit() {
            objBizDatagrid.edit("/buttoninfo/editpage/");
        }
        function Delete() {
            objBizDatagrid.del('/buttoninfo/delete/');
        }
        function PreviewIcon(val, row) {
            return '<span class="l-btn-left l-btn-icon-left"><span class="l-btn-text"></span><span class="l-btn-icon ' + row.Icon + '"></span></span>';
        }
        function FomentPosition(val) {
            switch (val) {
                case 0:
                    return "无";
                case 1:
                    return "顶部工具栏";
                case 2:
                    return "右键工具栏";
                default:
                    return "未知";
            }
        }
    </script>
}
